<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>获取元素的类名</title>
</head>
<body>
<div class="container"></div>
<script>
  var ele = document.querySelector('.container');
  //获取元素类名
  console.log(ele.className);
  //修改元素类名
  ele.className = 'content';
  console.log(ele.className);
</script>
</body>
</html>